package redbook.d20210904.t2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * @author habitplus
 * @since 2021-09-05 20:25
 */
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(bf.readLine());
        int[] a = new int[n];
        int[] b = new int[n];
        String[] ss1 = bf.readLine().split(" ");
        String[] ss2 = bf.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(ss1[i]);
            b[i] = Integer.parseInt(ss2[i]);
        }
        bf.close();

        int ans = slove(a,b);
        System.out.println(ans);
    }

    private static int slove(int[] a, int[] b) {
        if (a == null || a.length == 0) return 0;
        if (b == null || b.length == 0) return a.length;
        int n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = count(a[i]);
            b[i] = count(b[i]);
        }

        System.out.println(Arrays.toString(a));
        System.out.println(Arrays.toString(b));

        Arrays.sort(a);
        Arrays.sort(b);
        int ans = 0;
        int i = n-1;
        int j = n - 1;
        while (i >= 0) {

            while (j >= 0 && b[j] >= a[i]) j--;

            if (j >= 0) {
                ans++;
            } else {
                break;
            }
            j--;
            i--;
        }

        return ans;
    }

    private static int count(int k) {
        if (k == 1) return 1;
        int res = 2;
        int m = (int) Math.sqrt(k);
        for (int i = 2; i <= m; i++) {
            if (k % i == 0) res += 2;
        }

        return m * m == k ? res - 1 : res;
    }
}
